﻿using Microsoft.AspNetCore.Mvc;
using StudyCompanion.Commons.Result;

namespace StudyCompanion.Core.API
{
    public class ApiController : ControllerBase
    {
        [NonAction]
        protected static ProblemDetails Problem(string msg, int code = 400)
            => new() { Status = code, Detail = msg };

        [NonAction]
        protected static CommonResult Success()
            => new(200, "操作成功！");

        [NonAction]
        protected static CommonResult<T> Success<T>(T data)
            => new(data);
    }
}
